package com.leantech.android.browser.browser

import android.graphics.Bitmap
import android.net.Uri
import android.view.View
import android.webkit.PermissionRequest
import android.webkit.ValueCallback
import android.webkit.WebBackForwardList
import android.webkit.WebChromeClient
import com.leantech.android.browser.browser.web.RocketWebViewClient

/**
 * WebView的一些回调
 */
interface WebViewCallback {

    fun onProgressUpdate(progress: Int)

    fun onTitleUpdate(title: String?)

    fun onReceiveFavicon(url: String?, favicon: Bitmap)

    fun onShowCustomView(view: View, callback: WebChromeClient.CustomViewCallback)

    fun onHideCustomView()

    fun onPermissionRequest(request: PermissionRequest)

    fun onShowFileChooser(chooseCallback: ValueCallback<Array<Uri>>, params: WebChromeClient.FileChooserParams)

    fun onAddBrowserHistory(title: String, url: String, favicon: Bitmap?)

    fun onUrlChanged(title: String, newUrl: String, backForwardList: WebBackForwardList)

    //js interface.
    fun updateSelectionRect(left: Float, top: Float, right: Float, bottom: Float)


    fun onBlockIntent(chain: RocketWebViewClient.IntentBlockChain)

}